import { _decorator, Component, Label, Node, Sprite, v3 } from 'cc';
import { Task, TaskStatus } from '../entity/Task';
const { ccclass, property } = _decorator;

@ccclass('OtherTaskItem')
export class OtherTaskItem extends Component {
    @property(Sprite)
    cover:Sprite
    @property(Label)
    title:Label
    @property(Label)
    desc:Label
    @property(Node)
    receive:Node
    @property(Label)
    num:Label
    
    start() {

    }

    setData(task: Task) {
        this.desc.string = task.name

        if(task.status == TaskStatus.Complete){
            this.num.node.active = false
            this.receive.position = v3(this.receive.position.x, 0, 0)
        } else {
            this.receive.active = false
            this.num.string = task.statusStr
        }
    }
}


